package com.desmart.renjiao.commission;

import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.desmart.renjiao.R;
import com.desmart.renjiao.bean.CommissionInfo;
import com.lemon.library.common.router.JumpUtils;

import java.util.List;

public class CommissionAdapter extends BaseQuickAdapter<CommissionInfo,BaseViewHolder>{

    public CommissionAdapter(@Nullable List<CommissionInfo> data) {
        super(R.layout.list_item_commission, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CommissionInfo item) {
        helper.setText(R.id.tv_title,item.getTitle());
        helper.setText(R.id.tv_time,item.getSendDate());
        helper.setText(R.id.tv_commit_user,item.getTaskFrom());
        helper.setText(R.id.tv_from,"1".equals(item.getFlag()) ? "sap:" + item.getPriority(): "oa");
        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                JumpUtils.toWeb(mContext,item.getTaskURL(),item.getTitle());
            }
        });
    }
}
